import request from '/src/axios.js';
import {baseUrl} from "../../config/env";

export const deptApi = {
  getPage: (current, size, params) => request({
    url: baseUrl + '/api-user/dept/page',
    method: 'get',
    params: {
      ...params,
      current,
      size,
    }
  }),
  remove: (ids) => request({
    url: baseUrl + '/api-user/dept/remove',
    method: 'post',
    params: {
      ids,
    }
  }),
  create: (row) => request({
    url: baseUrl + '/api-user/dept/create',
    method: 'post',
    data: row
  }),
  update: (row) => request({
    url: baseUrl + '/api-user/dept/update',
    method: 'post',
    data: row
  }),
  getDept: (id) => request({
    url: baseUrl + '/api-user/dept/detail',
    method: 'get',
    params: {
      id,
    }
  }),
  getDeptTree: () => request({
    url: baseUrl + '/api-user/dept/tree',
    method: 'get'
  }),
  getTenantList: () => request({
    url: baseUrl + '/api-user/tenant/tenantList',
    method: 'get'
  }),
  // 查询网格列表
  listGrid: (query) => request({
    url: baseUrl + "/api-bureau/grid/list",
    method: "get",
    params: query,
  }),
  // 查询网格列表（排除节点）
  listGridExcludeChild: (gridId) => request({
    url: baseUrl + "/api-bureau/grid/list/exclude/" + gridId,
    method: "get",
  }),
  // 查询网格详细
  getGrid: (gridId) => request({
    url: baseUrl + "/api-bureau/grid/read/" + gridId,
    method: "get",
  }),
  //查询通讯录
  contacts: (query) => request({
    url: baseUrl + "api-bureau/contacts/page",
    method: "get",
    param: query
  }),
  // 查询网格下拉树结构
  treeselect: () => request({
    url: baseUrl + "/api-bureau/grid/treeselect",
    method: "get",
  }),
  // 根据角色ID查询网格树结构
  roleGridTreeselect: (roleId) => request({
    url: baseUrl + "/api-bureau/grid/roleDeptTreeselect/" + roleId,
    method: "get",
  }),
  // 新增网格
  addGrid: (data) => request({
    url: baseUrl + "/api-bureau/grid/add",
    method: "post",
    data: data,
  }),
  // 修改网格
  updateGrid: (data) => request({
    url: baseUrl + "/api-bureau/grid/edit",
    method: "put",
    data: data,
  }),
  // 删除网格
  delGrid: (girdId) => request({
    url: baseUrl + "/api-bureau/grid/remove/" + girdId,
    method: "delete",
  }),
  // 历史记录
  record: (workOrderId) => request({
    url: baseUrl + "/api-bureau/workOrder/history/list?workOrderId=" + workOrderId,
    method: "post",
  })
}
